<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>延迟函数</title>
</head>


<body>
    <script>
        /* 
         *延迟函数：setTimeOut(函数名,延迟的毫秒数,函数的参数)
         *                                                             
         */
        var fn = function(color) {
                document.body.style.backgroundColor = color;
            }
            //1.驱动延迟函数
        var setTime = setTimeout(fn, 2000, "blue");
        //2.清除延迟函数
        //clearTimeout(setTime);
    </script>
</body>

</html>